home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / chatter / chatter.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  3.7 KB  |  145 lines

  1. // chatter.cpp : Defines the class behaviors for the application.
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "chatter.h"
  15.  
  16. #include "mainfrm.h"
  17. #include "chatdoc.h"
  18. #include "chatvw.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CChatterApp
  27.  
  28. BEGIN_MESSAGE_MAP(CChatterApp, CWinApp)
  29.     //{{AFX_MSG_MAP(CChatterApp)
  30.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  31.         // NOTE - the ClassWizard will add and remove mapping macros here.
  32.         //    DO NOT EDIT what you see in these blocks of generated code!
  33.     //}}AFX_MSG_MAP
  34.     // Standard file based document commands
  35.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  36.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  37. END_MESSAGE_MAP()
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CChatterApp construction
  41.  
  42. CChatterApp::CChatterApp()
  43. {
  44. }
  45.  
  46. /////////////////////////////////////////////////////////////////////////////
  47. // The one and only CChatterApp object
  48.  
  49. CChatterApp theApp;
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CChatterApp initialization
  53.  
  54. BOOL CChatterApp::InitInstance()
  55. {
  56.     if (!AfxSocketInit())
  57.     {
  58.         AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
  59.         return FALSE;
  60.     }
  61.  
  62.     // Standard initialization
  63.     // If you are not using these features and wish to reduce the size
  64.     //  of your final executable, you should remove from the following
  65.     //  the specific initialization routines you do not need.
  66.  
  67.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  68.  
  69.     // Register the application's document templates.  Document templates
  70.     //  serve as the connection between documents, frame windows and views.
  71.  
  72.     CSingleDocTemplate* pDocTemplate;
  73.     pDocTemplate = new CSingleDocTemplate(
  74.         IDR_MAINFRAME,
  75.         RUNTIME_CLASS(CChatDoc),
  76.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  77.         RUNTIME_CLASS(CChatView));
  78.     AddDocTemplate(pDocTemplate);
  79.  
  80.     OnFileNew();
  81.     
  82.     return !(m_pMainWnd == NULL);
  83. }
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CAboutDlg dialog used for App About
  87.  
  88. class CAboutDlg : public CDialog
  89. {
  90. public:
  91.     CAboutDlg();
  92.  
  93. // Dialog Data
  94.     //{{AFX_DATA(CAboutDlg)
  95.     enum { IDD = IDD_ABOUTBOX };
  96.     //}}AFX_DATA
  97.  
  98. // Implementation
  99. protected:
  100.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  101.     //{{AFX_MSG(CAboutDlg)
  102.     virtual BOOL OnInitDialog();
  103.     //}}AFX_MSG
  104.  
  105.     DECLARE_MESSAGE_MAP()
  106. };
  107.  
  108. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  109. {
  110.     //{{AFX_DATA_INIT(CAboutDlg)
  111.     //}}AFX_DATA_INIT
  112. }
  113.  
  114. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  115. {
  116.     CDialog::DoDataExchange(pDX);
  117.     //{{AFX_DATA_MAP(CAboutDlg)
  118.     //}}AFX_DATA_MAP
  119. }
  120.  
  121. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  122.     //{{AFX_MSG_MAP(CAboutDlg)
  123.     //}}AFX_MSG_MAP
  124. END_MESSAGE_MAP()
  125.  
  126. /////////////////////////////////////////////////////////////////////////////
  127. // CAboutDlg message handlers
  128.  
  129. BOOL CAboutDlg::OnInitDialog() 
  130. {
  131.     CDialog::OnInitDialog();
  132.     CenterWindow();    
  133.     return TRUE;  }
  134.  
  135.  
  136. // App command to run the dialog
  137. void CChatterApp::OnAppAbout()
  138. {
  139.     CAboutDlg aboutDlg;
  140.     aboutDlg.DoModal();
  141. }
  142.  
  143. /////////////////////////////////////////////////////////////////////////////
  144. // CChatterApp commands
  145.